package com.zhuiyi.yiqingbackend.controller;

import com.zhuiyi.yiqingbackend.common.BaseResponse;
import com.zhuiyi.yiqingbackend.common.ResultUtils;
import com.zhuiyi.yiqingbackend.service.BannerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@CrossOrigin(origins = "*", maxAge = 3600)//跨越请求配置
@Api(value = "疫情-api", tags = "疫情防疫app-获取轮播图接口")
@RequestMapping("/banner")
public class BannerController {
    @Resource
    private BannerService bannerService;

    /**
     * 获取所有banner
     * @return
     */
    @GetMapping("/getBanners")
    @ApiOperation(value = "获取所有banner",notes = "获取所有banner")
    public BaseResponse<List<String>> getBanners() {
        List<String> banners = bannerService.getBanners();
        return ResultUtils.success(banners);
    }
}
